package com.ruoyi.system.service.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ProductZhangMapper;
import com.ruoyi.system.domain.ProductZhang;
import com.ruoyi.system.service.IProductZhangService;

/**
 * zhangService业务层处理
 * 
 * @author Alexis
 * @date 2024-02-26
 */
@Service
public class ProductZhangServiceImpl implements IProductZhangService 
{
    @Autowired
    private ProductZhangMapper productZhangMapper;

    /**
     * 查询zhang
     * 
     * @param id zhang主键
     * @return zhang
     */
    @Override
    public ProductZhang selectProductZhangById(String id)
    {
        return productZhangMapper.selectProductZhangById(id);
    }

    /**
     * 查询zhang列表
     * 
     * @param productZhang zhang
     * @return zhang
     */
    @Override
    public List<ProductZhang> selectProductZhangList(ProductZhang productZhang)
    {
        return productZhangMapper.selectProductZhangList(productZhang);
    }

    /**
     * 新增zhang
     * 
     * @param productZhang zhang
     * @return 结果
     */
    @Override
    public int insertProductZhang(ProductZhang productZhang)
    {
        return productZhangMapper.insertProductZhang(productZhang);
    }

    /**
     * 修改zhang
     * 
     * @param productZhang zhang
     * @return 结果
     */
    @Override
    public int updateProductZhang(ProductZhang productZhang)
    {
        return productZhangMapper.updateProductZhang(productZhang);
    }

    /**
     * 批量删除zhang
     * 
     * @param ids 需要删除的zhang主键
     * @return 结果
     */
    @Override
    public int deleteProductZhangByIds(String[] ids)
    {
        Arrays.stream(ids).forEach(
                i->{
                    ProductZhang productZhang = productZhangMapper.selectProductZhangById(i);
                    productZhang.setDeleteSoft(1);
                    productZhangMapper.updateProductZhang(productZhang);
                }
        );
        return 1;
    }

    /**
     * 删除zhang信息
     * 
     * @param id zhang主键
     * @return 结果
     */
    @Override
    public int deleteProductZhangById(String id)
    {
        return productZhangMapper.deleteProductZhangById(id);
    }
}
